package addon.w3.mdx.com;

import java.io.IOException;

import addon.w3.mdx.MDXCOM;
import addon.w3.mdx.LEDataInputStream;
import addon.w3.mdx.MDXException;

/**
 * struct {
		long	ReplaceableID;
		ASCII	TexturePath;		(0x100 bytes)
		long	???;			(0)
		long	Wrapping;		(1:WrapWidth;2:WrapHeight;3:Both)
	} textures[ntexs];
 * @author madjk
 *
 */
public class MDXTextureCOM extends MDXCOM {
	public int replaceAbleID = -1;
	public String texturePath = null;
	public int chunk1 = -1;
	public int wrapping = -1;
	
	public String getTag() {
		return "TEXS:COM";
	}
	
	public void _decode(LEDataInputStream ins) throws IOException, MDXException {
		replaceAbleID = ins.readInt();
		byte pathBytes[] = new byte[264];
		ins.read(pathBytes);
		texturePath = toString(pathBytes);
//		chunk1 = ins.readInt();
//		wrapping = ins.readInt();
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("TAG : "+getTag());
		sb.append("\n\tREPLACEABLEID : "+replaceAbleID);
		sb.append("\n\tTEXTUREPATH : "+texturePath);
//		sb.append("\n\tCHUNK_1 : "+chunk1);
//		sb.append("\n\tWRAPPING : "+wrapping);
		return sb.toString();
	}

	@Override
	public boolean isImplicitTag() {
		// TODO Auto-generated method stub
		return false;
	}
}
